package com.jielihaofeng.chat.convert;

import com.jielihaofeng.chat.entity.ChatMessageEntity;
import com.jielihaofeng.chat.vo.ChatMessageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;


@Mapper
public interface ChatMessageConvert {
    ChatMessageConvert INSTANCE = Mappers.getMapper(ChatMessageConvert.class);

    @Mapping(source = "status", target = "status", defaultValue = "0")
    @Mapping(source = "sender", target = "creator")
    @Mapping(source = "sender", target = "updater")
    ChatMessageEntity convert(ChatMessageVO vo);

    ChatMessageVO convert(ChatMessageEntity entity);

    List<ChatMessageVO> convertList(List<ChatMessageEntity> list);

}
